const path = require('path')

const HtmlWebpackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin.js')

module.exports = {
    entry: path.join(__dirname, './src/index.js'),
    output: {
        path: path.join(__dirname, './dist'),
        filename: 'lei.js'
    },
    mode: 'development', //  代码压缩不压缩  development(不压缩) ,production(压缩)
    plugins: [
        new VueLoaderPlugin(),
        new HtmlWebpackPlugin({
            template: path.join(__dirname, './src/index.html'),
            filename: 'index.html'
        })
    ],
    module: {
        rules: [{//处理css文件的
                test: /\.css$/,use: ['style-loader', 'css-loader']
            },
            {//处理less文件的
                test: /\.less$/,use: ['style-loader', 'css-loader', 'less-loader']
            },
            {//处理scss文件的
                test: /\.scss$/,use: ['style-loader', 'css-loader', 'sass-loader']
            },
            {//处理url文件的
                test: /\.(jpg|png|gif|bmp|jpeg)$/,use:'url-loader?limit=34981&name=[name]'
            },
            { // 处理 字体文件的
                test: /\.(ttf|eot|svg|woff|woff2)$/, use: 'url-loader'
            }, 
            {//处理babel文件的
                test:/\.js$/,use:'babel-loader', exclude:/node_modules/
            },
            {//处理vue文件的 
                test: /\.vue$/, use: 'vue-loader' 
            }
        ]
    },

}